﻿@{
    Layout = null;
    ViewData["Title"] = "ChaXun";
}
<script src="~/js/vue.js"></script>
<script src="~/js/axios.js"></script>
<script src="~/element-ui/lib/index.js"></script>
<link rel="stylesheet" href="~/element-ui/lib/theme-chalk/index.css" />
<div id="app">
    <template>
        <font color="black">
            您正在做的业务是：人力资源--招聘管理--职位发布管理--职位发布查询
        </font>
        <el-table :data="tableData"
                  style="width: 100%">
            <el-table-column prop="mre_id"
                             label="编号"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="first_kind_name"
                             label="I级机构名称"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="second_kind_name"
                             label="公司名称"
                             width="180">
            </el-table-column>
            <el-table-column prop="third_kind_name"
                             label="III级机构名称"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="major_kind_name"
                             label="职位分类名称"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="major_name"
                             label="职位名称"
                             width="180">
            </el-table-column>
            <el-table-column prop="human_amount"
                             label="招聘人数"
                             width="180">
            </el-table-column>
            <el-table-column prop="regist_time"
                             label="发布时间"
                             width="180">
                <template v-if="(scope.row.regist_time!='0001-01-01T00:00:00')" slot-scope="scope">{{scope.row.regist_time | dateFormat}}</template>
            </el-table-column>
            <el-table-column prop="engage_type"
                             label="招聘类型"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="deadline"
                             label="截止日期"
                             width="180">
                <template v-if="(scope.row.deadline!='0001-01-01T00:00:00')" slot-scope="scope">{{scope.row.deadline | dateFormat}}</template>
            </el-table-column>
            <el-table-column prop="changer"
                             label="变更人"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="change_time"
                             label="变更时间"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="major_describe"
                             label="职位描述"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column prop="engage_required"
                             label="招聘要求"
                             width="180"
                             v-if="false">
            </el-table-column>
            <el-table-column label="申请职位">
                <template slot-scope="scope">
                    <el-button size="primary"
                               v-on:click="ShenQing(scope.row)">申请该职位</el-button>
                </template>
            </el-table-column>
        </el-table>
    </template>
    <!--分页按钮-->
    <el-pagination v-on:size-change="handleSizeChange"
                   v-on:current-change="handleCurrentChange"
                   :current-page="currentPage"
                   :page-sizes="[2,4,6,8]"
                   :page-size="size"
                   layout="total, sizes, prev, pager, next, jumper"
                   :total="rows">
    </el-pagination>
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            tableData: [],
            currentPage: 1,
            //每页显示的行数
            rows: 1,
            //每页多少条数据
            size: 2,
        },
        methods: {
            Find() {
                axios.get("/ZhiWeiFaBuDengJi/FenYe", { params: { size: this.size, currentPage: this.currentPage } }).then(res => {
                    this.tableData = res.data.zhiWeiFaBuDengJis;
                    this.rows = res.data.rows;
                })
            },
            //时间过滤器方法
            TimeGuoLvQi() {
                // 定义时间过滤器，
                Vue.filter('dateFormat', function(originDate, pattern = '') {
                    // 根据给定的时间字符串，得到特定的时间
                    var dt = new Date(originDate)
                    //   yyyy-mm-dd
                    var y = dt.getFullYear()
                    var m = (dt.getMonth() + 1).toString().padStart(2, '0')
                    var d = dt.getDate().toString().padStart(2, '0')
                    if (pattern.toLowerCase() === 'yyyy-mm-dd') {
                        return `${y}-${m}-${d}`
                    } else {
                        var hh = dt.getHours().toString().padStart(2, '0')
                        var mm = dt.getMinutes().toString().padStart(2, '0')
                        var ss = dt.getSeconds().toString().padStart(2, '0')
                        //return `${y}-${m}-${d}`
                        return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
                    }
                })
            },
            //点击申请该职位
            ShenQing(row) {
                console.info(row)
                //跳转到简历登记  传个id过去  点谁传谁
                //window.location= "/JianLiGuanLi/Index";
                location.href = "/JianLiGuanLi/Index";
                //存储传值
                sessionStorage.setItem("major_kind_id", row.major_kind_id);
                sessionStorage.setItem("major_kind_name", row.major_kind_name);
                sessionStorage.setItem("major_id", row.major_id);
                sessionStorage.setItem("major_name", row.major_name);
                                sessionStorage.setItem("engage_type", row.engage_type);

            },
            //页码大小改变方法
            handleSizeChange(size) {
                this.size = size;
                this.Find();
            },
            //当前页改变查询
            handleCurrentChange(currentPage) {
                this.currentPage = currentPage;
                this.Find();
            },
        },
        mounted() {
            this.Find();
            this.TimeGuoLvQi();
        },
    })
</script>
